﻿//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;

//namespace Sunny.Controls
//{
//	public class ListSearchItem : SearchItem
//	{
//		private System.Windows.Controls.ContentControl _SimpleSearcherInput;
//		public override System.Windows.FrameworkElement SimpleSearcherInput
//		{
//			get
//			{
//				if (this._SimpleSearcherInput == null)
//					this._SimpleSearcherInput = new System.Windows.Controls.ContentControl();
//				return this._SimpleSearcherInput;
//			}
//		}

//		private System.Type _ListControlType;
//		[System.ComponentModel.TypeConverter(typeof(TypeTypeConverter))]
//		public System.Type ListControlType
//		{
//			get
//			{
//				if (this._SimpleSearcherInput == null)
//					return null;
//				if (this._SimpleSearcherInput.Content == null)
//					return null;
//				return this._SimpleSearcherInput.Content.GetType();
//			}
//			set
//			{
//				((System.Windows.Controls.ContentControl)this.SimpleSearcherInput).Content= (Sunny.Controls.DropDownList)System.Activator.CreateInstance(value);
//				((DropDownList)this._SimpleSearcherInput.Content).AllowNull = true;
//				((DropDownList)this._SimpleSearcherInput.Content).SelectedIndex = 0;
//			}
//		}

//		public object SelectedValue
//		{
//			get
//			{
//				if (this._SimpleSearcherInput == null)
//					return null;
//				if (this._SimpleSearcherInput.Content == null)
//					return null;
//				if (((DropDownList)this._SimpleSearcherInput.Content).SelectedValue is Telerik.Windows.Controls.RadComboBoxItem)
//					return null;
//				return ((DropDownList)this._SimpleSearcherInput.Content).SelectedValue;
//			}
//			set
//			{
//				((DropDownList)this._SimpleSearcherInput.Content).SelectedValue = value;
//			}
//		}

//		/*
//	{ Text: "包含", Value: "{0}.Contains({1})" },
//	{ Text: "不包含", Value: "!{0}.Contains({1})" },
//	{ Text: "等于", Value: "{0}=={1}" },
//	{ Text: "始于", Value: "{0}.StartsWith({1})" },
//	{ Text: "非始于", Value: "!{0}.StartsWith({1})" },
//	{ Text: "终于", Value: "{0}.EndsWith({1})" },
//	{ Text: "非终于", Value: "!{0}.EndsWith({1})" }
//		 */
//		private Operator[] _OperatorOptions;
//		public override Operator[] Operators
//		{
//			get
//			{
//				if (this._OperatorOptions == null)
//					this._OperatorOptions = new Operator[]
//                    {
//                        new Operator("=","{0}={1}"),
//                        new Operator("≠","{0}!={1}"),
//                        new Operator(">","{0}>{1}"),
//                        new Operator("≥","{0}>={1}"),
//                        new Operator("<","{0}<{1}"),
//                        new Operator("≤","{0}<={1}")
//                    };
//				return this._OperatorOptions;
//			}
//		}

//		public override System.Windows.FrameworkElement AdvanceSearcherInput
//		{
//			get
//			{
//				return (System.Windows.FrameworkElement)System.Activator.CreateInstance(this.ListControlType);
//			}
//		}

//		public override Searcher.WhereCommand GetCommand(string field, int index)
//		{
//			if (this.SelectedValue == null)
//				return null;
//			return new Searcher.WhereCommand { Text = string.Format("{0}==@{1}", field, index), Parameters = new object[] { this.SelectedValue } };
//		}

//		public override void Empty()
//		{
//			//if (this._SimpleSearcherInput != null)
//			((DropDownList)this._SimpleSearcherInput.Content).SelectedIndex = 0;
//		}
//	}
//}